<?php

function smarty_block_link($params, $content, &$smarty, &$repeat)
{
   if (isset($content)) 
   {
      global $par;

      $url = new Url( strlen($content) ? $content : $par->href());

      foreach ($params as $nm => $val) 
      {
         if (!is_null($val)) {
            $url->setParam($nm,$val);
         }
         else {
            $url->remParam($nm);
         }
      }

      return (string)$url;
   }
}

?>